home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 6
/
The Arsenal Files 6 (Arsenal Computer).ISO
/
prg_casm
/
jlvesa11.zip
/
JLVESA06.ASM
< prev
next >
Wrap
Assembly Source File
|
1995-11-14
|
3KB
|
151 lines
; This routine is part of VESA SVGA -library
;
; Copyright 1994 Johannes Lehtinen
; All rights reserved
model large,c
p386
include "jlvesads.asm"
segment jlvesa06_TEXT USE16 'CODE'
assume cs:jlvesa06_TEXT
; void JVScreen_ClearAll(JVUByte color)
;
; Clears video memory to given color.
proc JVScreen_ClearAll far
public JVScreen_ClearAll
push bp
mov bp,sp
push di
push ds
push es
mov ax,JLVesa_Data
mov ds,ax
; First move write window to the start of video memory if needed
cmp [ds:WAStart],0
je short already_zero
mov bl,[ds:WWin]
xor bh,bh
xor dx,dx
call [ds:PosFunc]
mov [ds:WAStart],0
; EBX = Absolute address, AEX = Color used to clear
already_zero:
mov al,[ss:bp+6]
shl eax,8
mov al,[ss:bp+6]
shl eax,8
mov al,[ss:bp+6]
shl eax,8
mov al,[ss:bp+6]
mov bx,[ds:WWSeg] ; ES = Window segment
mov es,bx
xor ebx,ebx
cld ; Direction forward
; Loop where the action takes place
; Check if there is whole block left
clr_loop:
mov ecx,[ds:WAStart]
add ecx,[ds:WSize]
cmp [ds:Size],ecx
jbe short last_block
; Copy one block
mov edi,ebx
sub edi,[ds:WAStart]
mov ecx,[ds:WSize]
sub ecx,edi
shr ecx,2
rep stosd
; Take next block
mov ebx,[ds:WAStart]
add ebx,[ds:WSize]
; Change window
push eax
mov eax,ebx
mov ecx,[ds:Granularity]
xor edx,edx
div ecx
push ebx
mov dx,ax
xor bh,bh
mov bl,[ds:WWin]
push ax
call [ds:PosFunc]
xor eax,eax
pop ax
pop ebx
mul ecx
mov [ds:WAStart],eax
pop eax
jmp short clr_loop
; Copy the last block
; Count where to start and how many bytes to write
last_block:
mov edi,ebx
sub edi,[ds:WAStart]
mov ecx,[ds:Size]
sub ecx,ebx
dec ecx
mov dl,cl
shr ecx,2
rep stosd
test dl,2
jz short not_2_left
stosw
not_2_left:
test dl,1
jz short not_1_left
stosb
; Memory cleared, set read window point to another window if necessary
not_1_left:
mov al,[ds:WWin]
cmp [ds:RWin],al
jne short not_same_window
mov eax,[ds:WAStart]
mov [ds:RAStart],eax
not_same_window:
pop es
pop ds
pop di
pop bp
retf
endp JVScreen_ClearAll
ends
end